home *** CD-ROM | disk | FTP | other *** search
/ AppleScript - The Beta Release / AppleScript - The Beta Release.iso / Documentation / develop / Better Apple Event Coding / Code Samples / AppLib.r < prev    next >
Encoding:
Text File  |  1992-10-16  |  4.2 KB  |  183 lines  |  [TEXT/MPS ]

  1. /*------------------------------------------------------------------------------------------
  2.  
  3.     Program:    CPlusTESample 2.0
  4.     File:        AppLib.r
  5.     Uses:        AppLib.h
  6.  
  7.     by Andrew Shebanow
  8.     of Apple Macintosh Developer Technical Support
  9.  
  10.     Copyright © 1989-1990 Apple Computer, Inc.
  11.     All rights reserved.
  12.  
  13. ------------------------------------------------------------------------------------------*/
  14.  
  15.  
  16. #include "SysTypes.r"
  17. #include "Types.r"
  18.  
  19. #include "AppLib.h"
  20.  
  21. /* this ALRT and DITL are used as an error screen */
  22. resource 'ALRT' (rUserAlert) {
  23.     {40, 20, 150, 260},
  24.     rUserAlert,
  25.     { /* array: 4 elements */
  26.         /* [1] */
  27.         OK, visible, silent,
  28.         /* [2] */
  29.         OK, visible, silent,
  30.         /* [3] */
  31.         OK, visible, silent,
  32.         /* [4] */
  33.         OK, visible, silent
  34.     }
  35. };
  36.  
  37. resource 'DITL' (rUserAlert) {
  38.     { /* array DITLarray: 3 elements */
  39.         /* [1] */
  40.         {80, 150, 100, 230},
  41.         Button {
  42.             enabled,
  43.             "OK"
  44.         },
  45.         /* [2] */
  46.         {10, 60, 60, 230},
  47.         StaticText {
  48.             disabled,
  49.             "^0"
  50.         },
  51.         /* [3] */
  52.         {8, 8, 40, 40},
  53.         Icon {
  54.             disabled,
  55.             2
  56.         }
  57.     }
  58. };
  59.  
  60. resource 'ALRT' (rSaveAlert, purgeable) {
  61.     {147, 110, 275, 355},
  62.     rSaveAlert,
  63.     {    /* array: 4 elements */
  64.         /* [1] */
  65.         OK, visible, sound1,
  66.         /* [2] */
  67.         OK, visible, sound1,
  68.         /* [3] */
  69.         OK, visible, sound1,
  70.         /* [4] */
  71.         OK, visible, sound1
  72.     }
  73. };
  74.  
  75. resource 'DITL' (rSaveAlert, purgeable) {
  76.     {    /* array DITLarray: 4 elements */
  77.         /* [1] */
  78.         {77, 14, 95, 81},
  79.         Button {
  80.             enabled,
  81.             "Yes"
  82.         },
  83.         /* [2] */
  84.         {102, 14, 120, 80},
  85.         Button {
  86.             enabled,
  87.             "No"
  88.         },
  89.         /* [3] */
  90.         {102, 160, 120, 228},
  91.         Button {
  92.             enabled,
  93.             "Cancel"
  94.         },
  95.         /* [4] */
  96.         {4, 14, 73, 230},
  97.         StaticText {
  98.             disabled,
  99.             "Save changes to \"^0\" before ^1?"
  100.         }
  101.     }
  102. };
  103.  
  104. resource 'STR#' (kErrStrings, purgeable) {
  105.     {
  106.     "This application requires a 512Ke or later Macintosh.";
  107.     "Application memory size too small.";
  108.     "Unable to open document.";
  109.     "Error reading document."
  110.     }
  111. };
  112.  
  113. resource 'STR#' (kBuzzwordStrings, purgeable) {
  114.     {
  115.     "quitting";
  116.     "closing"
  117.     }
  118. };
  119.  
  120. /*
  121.  * errs resource:
  122.  *
  123.  *    this is lifted from MacApp 2.0. It maps an error code into
  124.  * a meaningful error string. Of course, if I had written this
  125.  * sample in MacApp, I wouldn't be forced to reinvent the wheel,
  126.  * right?
  127.  */
  128.  
  129. type 'errs' {
  130.     wide array {                        // Error list
  131.         integer     whichList = 0,
  132.                     minErr = -32768;    // Low error number; 0 specifies STR#
  133.         integer     maxErr = 32767;     // High error number
  134.         integer;                        // Index in STR# of string
  135.     };
  136. };
  137. resource 'errs' (kSysErrStrings, purgeable) {
  138.     {    whichList, 0, kSysErrStrings;
  139.         -117, -108, 4;        // Memory Manager errors
  140.         -42, -42, 16;        // too many files are open
  141.         -47, -47, 7;        // files are open
  142.         -49, -49, 7;        // can't have > 1 writer to a file
  143.         -54, -54, 6;        // can't open locked file for writing
  144.         -45, -45, 6;        // file locked
  145.         -46, -44, 3;        // volumes locked
  146.         -34, -33, 2;        // disk full
  147.         -53, -53, 15;        // volume offline
  148.         -84, -33, 5;        // other File Manager / disk errors
  149.         -124, -124, 10;     // Lost volume on AppleTalk
  150.         -127, -120, 5;        // HFS errors
  151.         -27, -27, 9;        // printer I/O error
  152.         -192, -192, 17;        // Resource not found
  153.         -4101, -4101, 8;    // printer not found (PAP)
  154.         -4100, -4096, 9;    // printer comm error
  155.         -5000, -5000, 11;    // AFP access error
  156.         -5006, -5006, 7;    // AFP: deny conflict
  157.         -5029, -5000, 10;    // AFP errors
  158.         -95, -91, 12;        // AppleTalk operation errors
  159.         -98, -97, 13;        // AppleTalk could not be opened
  160.         minErr, maxErr, 1
  161.     }
  162. };
  163.  
  164. resource 'STR#' (kSysErrStrings, purgeable) {
  165.     {    /* [1] */    "A program error occurred.";                        // catch-all
  166.         /* [2] */    "The disk is full.";
  167.         /* [3] */    "The disk is locked.";
  168.         /* [4] */    "Out of memory.";
  169.         /* [5] */    "A disk error occurred.";
  170.         /* [6] */    "The file is locked.";
  171.         /* [7] */    "The file is already in use or was left open.";
  172.         /* [8] */    "The printer could not be found.";
  173.         /* [9] */    "There is a problem communicating with the printer.";
  174.         /* [10] */    "There is a problem with the file server.";            // catch-all AFP error
  175.         /* [11] */    "You do not have the necessary access privileges.";    // AFP: access denied
  176.         /* [12] */    "There is a problem with AppleTalk.";                // AppleTalk operation errors
  177.         /* [13] */    "AppleTalk is not connected.";                        // AppleTalk open errors
  178.         /* [14] */    "The disk is not available.";
  179.         /* [15] */    "There are too many files open.";                    // Resource not found
  180.         /* [16] */    "The required resource(s) were not found."
  181.     }
  182. };
  183.